cmake_minimum_required(VERSION 3.12)
project(custom_section_demo C)

# 设置编译选项
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-variable")

# 指定链接脚本路径
# set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld)
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/app.ld)

# 生成可执行文件
add_executable(${PROJECT_NAME}
    src/main.c
)

# 添加链接选项（指定自定义链接脚本）
# target_link_options(${PROJECT_NAME} PRIVATE)
target_link_options(${PROJECT_NAME} PRIVATE
    -T ${LINKER_SCRIPT}
)
